using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class GSCSlipDetailMap : EntityTypeConfiguration<GSCSlipDetail>
	{
		public GSCSlipDetailMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.BillingNote)
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("GSCSlipDetails");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.GSCSlipId).HasColumnName("GSCSlipId");
			this.Property(t => t.BillingNote).HasColumnName("BillingNote");
			this.Property(t => t.Qty).HasColumnName("Qty");
			this.Property(t => t.Cost).HasColumnName("Cost");
			this.Property(t => t.Discount).HasColumnName("Discount");
			this.Property(t => t.Note).HasColumnName("Note");

			// Relationships
			this.HasOptional(t => t.GSCSlip)
				.WithMany(t => t.GSCSlipDetails)
				.HasForeignKey(d => d.GSCSlipId);
				
		}
	}
}

